<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        body{
            min-width: 1593px;
        }
        .zhizuo{
            margin-top: 50px;
        }
        img{
            vertical-align:bottom;
        }
        a{
            color: #fff;
            text-decoration:none;
            cursor: pointer;
        }
        #box{
            width:900px ;
            height: 720px;
            background: black;
            margin: auto;
            text-align: center;
            position: relative;
            font-size: 50px;
            color: #fff;
            transition: all 2s linear;
            /*display: none;*/
        }

        #box1{
            width:900px ;
            height: 720px;
            background: black;
            margin: auto;
            text-align: center;
            position: relative;
            display: none;
        }
        #shuoming{
            color: #fff;
            width:900px ;
            height: 720px;
            background: black;
            margin: auto;
            position: relative;
            text-align: center;
            font-size: 40px;
            display: none;
        }

        #shuoming p{
            margin:auto;
            padding: 20px;
            position: absolute;
            top: 102%;
            left: 0;
            animation:sm 4s linear 1;
            animation-fill-mode: forwards;
        }
        @keyframes sm {
            from{top:102%;}
            to{top: 0%}

        }
        .fanhui{
            cursor: pointer;
            position: absolute;
            top:90%;
            left: 80%;
        }
        #box2{
            width:1410px ;
            height: 1013px;
            color: #50c8ff;
            /*border:1px solid red;*/
            margin:auto;
            float: left;
            display: none;
        }
        .tk,#Hero_t,#Hero_b,#Hero_l,#Hero_r,#Hero{
            width: 58px;
            height: 59px;
        }
        .i_1{
            margin-top: 100px;
        }
        .box_2,.box_3,.box_4{
            width: 250px;
            text-align: center;
            font-size: 44px;
            font-family: "仿宋";
            color: #fff;
            margin: 30px auto 0;
            cursor: pointer;

        }
        .box_2:hover{
            width:249px ;
            height: 50px;
            background-image: url(bj.png);
            background-position: bottom;
        }
        .box_3:hover{
            width:249px ;
            height: 50px;
            background-image: url(bj.png);
            background-position: bottom;
        }
        .box_4:hover{
            width:249px ;
            height: 50px;
            background-image: url(bj.png);
            background-position: bottom;
        }
        #duizhan,#key,#xueliang,#jian,#dajian,#gameover,#tishi{
            position: absolute;
            left: 0;
            right: 0;
            top: 10%;
            margin: auto;
            width: 600px;
            height: 400px;
            border: 10px solid #69492e;
            background-color: #FFFFFF;
            display: none;
            color: crimson;
            text-align: center;
        }
        #tishi p{
            font-size: 25px;
        }
    #shuxing{
        width: 180px;
        height: 500px;
        float: left;
        border: 10px solid #69492e;
        display: none;
        }
    </style>
</head>
<body>
<embed src="beijing.mp3" hidden="true" autostart="true" loop="true">
<div id="duizhan">
    <img src="imgs/timg.gif" alt="#"/>
    <h2>一顿操作猛如虎，一看战绩0-5.</h2>
</div>
<div id="gameover">
    <img src="imgs/Gameover.jpg" alt="#"/>
    <h2>恭喜你救到了真公主，游戏结束</h2>
    <P>后来，因为长得太丑，被公主直接捅死。</P>
</div>
<div id="key">
    <h2>恭喜你得到一把钥匙</h2>
</div>
<div id="tishi">
    <h2>勇者！谢谢你救了我 <h1>
        进入楼梯时：双击地图就会改变，但你将前进不了。
        所以，单击后，
        <p>1楼楼梯
            <br/>点击一下向右，进入第2层。
            <br/>返回第1层时，点击一下向右。
            <br/> 2楼楼梯
            <br/>向左，进入第3层。
            <br/> 返回第2层时，点击一下向左。

        </p>
</div>
<div id="xueliang"></div>
<div id="jian"></div>
<div id="dajian"></div>
<div id="shuxing">
    <div id="shu1"></div>
    <div id="shu2"></div>
    <div id="shu3"></div>
    <div id="shu4"></div>

</div>
    <!--制作人页面-->
    <div id="box" >
        <a id=delay style="visibility:hidden" onclick="fun_1()">
            <img class="zhizuo" src="imgs/zhizuo.png" alt="#"/>
            冠名特约制作
            <br/><br/><br/>
            <strong>点击进入</strong>
        </a>
    </div>
    <!--开始页面-->
    <div id="box1">
        <img class="i_1" src="imgs/mota.png" alt="*"/>

        <div class="box_2" >
            <a  onclick="fun_2()">
                <strong>开始游戏</strong>
            </a>
        </div>
        <div class="box_3">
            <a  onclick="fun_4()">
                <strong>游戏说明</strong>
            </a>
        </div>
        <div class="box_4" onclick="fun_3()">
            <a>
                <strong>离开游戏</strong>
            </a>
        </div>
    </div>
    <!--说明-->
    <div id="shuoming">
        <p>(元祖魔塔）一位魔王为了想要一个比他更厉害的人来拯救世界，拿公主做诱饵，引诱了一位勇者（就是你）进入魔塔。
            <br/>
        《魔塔》是一种策略类的固定数值RPG游戏。游戏需要动很多脑筋，任何一个轻率的选择都可能导致游戏的失败。魔塔游戏虽不大，但是制作精美，道具很多，而且难度不低，对智商是一次艰巨的考验。
            虽然魔塔的界面很像是一般的地牢游戏，貌似随便的打打杀杀就可以过关，但事实上玩这个游戏需要动很多脑筋，任何一个轻率的选择都可能导致游戏的失败。一定不要错过！
            <div class="fanhui" onclick="fun_5()"><strong>返回</strong></div></p>
    </div>
    <!--游戏页面-->
    <div id="box2"></div>





    <script  type="text/javascript">
    setTimeout("delay.style.visibility='visible'",3000);


    var box = document.getElementById("box");
    var box1 = document.getElementById("box1");
    var box2 = document.getElementById("box2");
    var shuoming = document.getElementById("shuoming");
    var box3 = document.getElementById("box3");
    var shuxing=document.getElementById("shuxing")
    var duizhan = document.getElementById("duizhan");
    var gameover = document.getElementById("gameover");
    var key = document.getElementById("key");
    var xueliang = document.getElementById("xueliang");
    var jian = document.getElementById("jian");
    var dajian = document.getElementById("dajian");
    var Hero = document.getElementById("Hero");
    var tishi = document.getElementById("tishi");
    var xu =80;
    var gjl = 10;
    var keyshu = 0;
    var sgs = 0;
    var shu1 = document.getElementById("shu1");
        shu1.innerHTML="<h3>你当前的血量<h3>"+xu;
    var shu2 = document.getElementById("shu2");
        shu2.innerHTML="<h3>你当前的攻击力<h3>"+gjl;
    var shu3 = document.getElementById("shu3");
        shu3.innerHTML="<h3>你当前的钥匙数<h3>"+keyshu;
    var shu4 = document.getElementById("shu4");
        shu4.innerHTML="<h3>你当前的杀怪数<h3>"+sgs;



        function fun_1(){
            box.style.display = "none";
            box1.style.display = "block";
    }
        function fun_2(){
            box1.style.display = "none";
            box2.style.display = "block";
            shuxing.style.display = "block";
        }
        function fun_4(){
            box1.style.display = "none";
            shuoming.style.display = "block";
        }
        function fun_5(){
            box1.style.display = "block";
            shuoming.style.display = "none";
        }
        function fun_3(){
            if
            (confirm("您确定要关闭本页吗？")){
                console.log(23423);
                window.opener=null;
                window.open('','_self');
                window.close();
            }
            else{}
        }


//    1.墙
//    2.骷髅怪
//    3.勇者自己
//    4.钥匙
//    5.宝剑
//    6.门
//    7.血（火）海
//    8.大宝剑
//    9.血瓶
//    10.巫师怪
//    11.上（2）楼梯
//    12.下（1）楼梯
//    13.上（3）楼梯
//    14.下（2）楼梯
//    15.公主
//    16.魔王
//    17.警示版

    var map = [
        [1,1,1,1,1,1,1,1,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,22],
        [1,1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,10,0,0,0,0,0,1,21],
        [5,5,5,5,5,5,7,1,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,0],
        [5,5,5,5,5,5,7,1,1,1,1,0,1,0,1,1,1,0,0,1,1,1,1,1],
        [8,8,8,8,8,8,7,0,0,0,1,23,1,0,1,0,0,0,0,0,0,0,0,0],
        [8,8,8,8,8,8,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
        [6,1,1,1,1,1,1,1,1,1,1,1,1,1,6,1,1,1,1,1,1,1,1,1],
        [2,0,0,0,0,0,1,0,0,0,0,0,2,2,2,2,2,0,1,0,0,10,0,0],
        [0,1,1,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0,7,7,7,10,0,0],
        [0,0,0,1,0,0,1,9,1,0,0,0,0,0,0,0,0,0,7,5,5,10,0,0],
        [0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,7,7,7,10,0,0],
        [0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,7,5,4,2,0,0],
        [0,1,1,1,1,1,1,7,0,0,0,0,0,0,9,1,0,0,7,7,7,10,0,1],
        [9,9,9,9,9,9,1,7,7,0,0,0,0,0,5,1,0,0,0,0,0,0,0,1],
        [1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1],
        [8,9,9,0,0,0,0,0,21,21,0,0,18,0,0,0,0,0,0,0,0,0,0,19],
        [7,7,7,7,1,1,1,1,1,1,1,7,7,7,7,1,1,1,1,1,1,0,1,1]
    ]
    var map2 = [
        [7,7,7,7,7,7,7,7,12,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,1,1,1,1,1,1,7,0,0,0,1,1,9,9,9,2,2,0,0,0,0,0,7],
        [7,7,9,2,2,2,7,7,7,7,0,0,1,9,9,9,1,1,1,1,1,0,0,7],
        [7,7,9,2,2,2,7,0,0,0,0,0,1,1,1,1,1,0,0,1,0,0,0,7],
        [7,7,9,2,2,2,7,0,0,0,10,0,0,0,9,0,0,0,0,1,0,0,0,7],
        [7,7,9,2,2,2,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7],
        [7,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,7],
        [7,0,0,0,2,9,1,0,0,10,10,0,0,0,10,0,0,0,7,2,2,2,0,7],
        [7,0,0,0,2,4,1,0,10,0,0,10,0,0,10,0,0,0,7,2,0,0,2,7],
        [7,0,0,0,2,4,1,0,10,0,0,0,0,0,10,0,0,0,7,2,0,0,2,7],
        [7,6,7,7,7,7,1,0,0,10,10,0,0,0,0,0,0,0,7,2,2,2,0,7],
        [7,0,0,0,0,0,0,0,0,0,0,10,1,1,1,1,0,0,0,2,0,0,2,7],
        [7,0,9,0,0,0,9,0,10,0,0,10,0,0,0,1,0,0,0,2,0,0,2,7],
        [7,0,0,0,0,0,0,0,0,10,10,0,0,0,0,1,0,0,0,2,2,2,4,7],
        [7,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,7],
        [7,7,7,7,1,1,1,1,1,1,1,0,7,7,7,1,1,1,1,1,1,1,1,7],
        [7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,13,7]

    ]
    var map3 = [
        [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,15,7,7,7,7,7],
        [7,7,7,7,7,7,7,16,26,0,0,0,0,0,0,0,6,0,0,7,7,7,7,7],
        [7,7,1,1,1,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,1,7,7,7,1,7,16,0,0,0,0,0,0,0,0,16,7,7,7,7,7,7,7],
        [7,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7],
        [7,1,7,1,1,1,7,16,0,0,0,0,0,0,0,0,16,7,7,7,7,7,7,7],
        [7,1,7,7,7,1,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,7,1,1,1,7,7,16,0,0,0,0,0,0,0,0,16,7,7,7,7,7,7,7],
        [7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7],
        [7,7,1,1,1,7,7,16,0,0,0,0,0,0,0,0,16,7,7,7,7,7,7,7],
        [7,1,7,7,7,1,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,1,7,7,7,7,7,16,0,0,0,16,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,1,7,1,1,1,7,7,7,7,7,25,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,1,7,7,7,1,7,7,7,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,7,1,1,1,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7],
        [7,7,7,7,7,7,7,7,7,7,7,0,0,0,24,0,0,0,0,0,0,0,14,7]

    ]

    var x = 16, y = 21;
    function huantu(ditu){


        var body = document.getElementsByTagName("body")[0];


//执行区
        document.body.onkeydown = WallDetection;
        cg_1(1,ditu);
// 函数区
        function WallDetection(){
            WallDetectionDate();
            console.log("x"+x+"  y"+y);
        }
  /*    墙壁检测-移动数据-函数*/
        function WallDetectionDate(){
            var k = event.keyCode;
        if(k == 38){//上
            //判断是否撞墙  边界检测
                if(x>0){
                    Boundary("top",-1,0);
                    cg_1("top")
                }
            }else if(k == 40){//下
                if( x<16 ){
                    Boundary("bottom",1,0);
                    cg_1("bottom")
                }
            }
            else if(k == 39){//右
                if( y<23 ){
                    Boundary("right",0,1);
                    cg_1("right")
                }
            }
            else if(k == 37){//左
                if( y>0 ){
                    Boundary("left",0,-1);
                    cg_1("left")
                }
            }
        }
//


 /*    核心检测-函数*/
        function Boundary(str,changex,changey){
            console.log(ditu[x+changex][y+changey]);
            if(ditu[x+changex][y+changey]==0 ){
                console.log("~~~~  x"+x+"  y"+y);
                ditu[x][y] = 0;
                x = x+changex;
                y = y+changey;
                ditu[x][y] = 3;
                return;
            }else if(ditu[x+changex][y+changey]==2 ){
                VSMonster(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==4){
                OBtain(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==5){
                Jian(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==6){
                Door(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==8){
                DaJian(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==9){
                XUeliang(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==10){
                VSMonster(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==11){
                console.log("552  x"+x+"  y"+y);
                S_lou(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==12){
                X_lou(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==13){
                S_lou2(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==14){
                X_lou2(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==15){
                Gameover(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==16){
                Damowang(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==17){
                Jshi(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==18){
                Daliwan(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==19){
                Angel(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==20){
                Angel1(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==21){
                Postern(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==22){
                Postern1(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==23){
                Jshiy(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==24){
                Jshiy1(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==25){
                Jshiy2(x+changex,y+changey);
                return;
            }else if(ditu[x+changex][y+changey]==26){
                Jshiy3(x+changex,y+changey);
                return;
            }
        }

        //遭遇天使（提示）
        function Angel1(x,y){
            tishi.style.display = "block";
            setTimeout(function(){
                tishi.style.display = "none";
            },10000);

        }
        //遭遇天使(指示)
        function Angel(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>你好，勇者，楼梯被魔王设置了幻术。<br/>在本层找到另一个天使，你将得到楼梯的真相。<h1> ";
            setTimeout(function(){
                key.style.display = "none";
            },5000);
        }
//        暗道墙壁
        function Postern(x,y){
            setTimeout(function(){
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}
            },3000);
            ditu[x][y] = 0;
        }
//           暗道墙壁变天使
        function Postern1(x,y){
            setTimeout(function(){
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}
            },3000);
            ditu[x][y] = 20;
        }
        //打怪函数
        function VSMonster(x,y){
            duizhan.style.display = "block";
            xu = xu + gjl- 140;
            if (xu<=0){
                duizhan.style.display = "none";
                key.style.display = "block";
                key.innerHTML="<h1>胜败乃兵家常事，请大侠重新来过<h1> ";
                setTimeout(function(){
                    //战胜的情况
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                        if(duizhan.style.display = "none"){
                        box1.style.display = "block";
                            box2.style.display = "none";
                            shuxing.style.display = "none";
                }
                },3000);

            }else{
                var shu1 = document.getElementById("shu1");
                    shu1.innerHTML="<h3>你当前的血量<h3>"+xu;
                    sgs +=1;
                    var shu4 = document.getElementById("shu4");
                        shu4.innerHTML="<h3>你当前的杀怪数<h3>"+sgs;
                        setTimeout(function(){
                            duizhan.style.display = "none";
                            //战败的情况
                            console.log(x)
                            console.log(y)
                            console.log(ditu[x][y])
                            cg_1(1,ditu);
                        },2000);
                        ditu[x][y] = 0;
            }
        }
        //   遇到门
        function Door(x,y){
            key.innerHTML="<h1>你打开了你面前的一道门<h1> ";
            console.log("钥匙"+keyshu)
            key.style.display = "block";
            if (keyshu>0){
                keyshu =keyshu-1;
                var shu3 = document.getElementById("shu3");
                shu3.innerHTML="<h3>你当前的钥匙数<h3>"+keyshu;
                setTimeout(function(){
                    key.style.display = "none";
                    //打开的情况
                        console.log(x)
                        console.log(y)
                        console.log(ditu[x][y])
                        cg_1(1,ditu);
                },3000);
                ditu[x][y] = 0;
            }else{
                key.innerHTML="<h1>你么有钥匙啊<h1> ";
                setTimeout(function(){
                    key.style.display = "none";
                    //打不开的情况
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                },3000);
            }

        }
        //得到钥匙
        function OBtain(x,y){
            keyshu +=1;
            key.innerHTML="<h1>你获得了一把钥匙：数量加<h1> "+ 1;
            key.style.display = "block";
            var shu3 = document.getElementById("shu3");
            shu3.innerHTML="<h3>你当前的钥匙数<h3>"+keyshu;
            setTimeout(function(){
                key.style.display = "none";
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}
            },3000);
            ditu[x][y] = 0;
        }


//    得到血瓶血量
        function XUeliang(x,y){
            xueliang.innerHTML="<h1>你获得了一个血瓶：血量加<h1> "+ 50;
            xu += 50;
            xueliang.style.display = "block";
            var shu1 = document.getElementById("shu1");
            shu1.innerHTML="<h3>你当前的血量<h3>"+xu;
            setTimeout(function(){
                xueliang.style.display = "none";
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}

            },3000);
            ditu[x][y] = 0;
        }
//得到宝剑

        function Jian(x,y){
            gjl += 10;
            jian.innerHTML="<h1>你获得了一个宝剑：攻击力加<h1> "+ 10;
            jian.style.display = "block";
            var shu2 = document.getElementById("shu2");
            shu2.innerHTML="<h3>你当前的攻击力<h3>"+gjl;
            setTimeout(function(){
                jian.style.display = "none";
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}
            },3000);
            ditu[x][y] = 0;
        }
//    得到大宝剑
        function DaJian(x,y){
            gjl += 50;
            dajian.innerHTML="<h1>你获得了一个大宝剑：攻击力加<h1> "+ 50;
            dajian.style.display = "block";
            var shu2 = document.getElementById("shu2");
            shu2.innerHTML="<h3>你当前的攻击力<h3>"+gjl;
            setTimeout(function(){
                dajian.style.display = "none";
                //得到的情况
                if(true){
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                }else{}
            },3000);
            ditu[x][y] = 0;
        }

        //   下1楼
        function X_lou(x,y){
            huantu(map);
            console.log("123 x"+x+"  y"+y)
        }
        //    上2楼
        function S_lou(x,y){
            huantu(map2);
        }

        //    下2楼
        function X_lou2(x,y){
            huantu(map2);
        }
        //    上3楼
        function S_lou2(x,y){
//            key.style.display = "block";
//            key.innerHTML="<h1>在地图没改变之前点击一下向左，进入第三层.<h1> ";
//            setTimeout(function(){
//                key.style.display = "none";
//            },3000);
            huantu(map3);
        }
//        警示版1层
        function Jshiy(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>你得到天使的提示了吗？<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },3000);
            ditu[x][y] = 0;
        }
//        警示版2层
        function Jshi(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>此行将是有去无回，你确定吗？请做好周全的准备再继续前行.<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },3000);
            ditu[x][y] = 0;
        }
    //        警示版3层24
        function Jshiy1(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>呼~呼~公主应该就在这层了。<br>等着我。公主<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },3000);
            ditu[x][y] = 0;
        }
        //        警示版3层25
        function Jshiy2(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>小子，想要救公主，先过老夫这关！！<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },3000);
            ditu[x][y] = 0;
        }
        //        警示版3层26
        function Jshiy3(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>想不到老夫竟然会输，年轻人，未来就托付于你了。<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },3000);
            ditu[x][y] = 0;
        }
//        大力丸
        function Daliwan(x,y){
            key.style.display = "block";
            key.innerHTML="<h1>哎呦我去，你踩到一坨千年老翔，恭喜你获得神丹大力丸，当你的攻击力大于怪物时，将按超出部分产生嗜血效果<h1> ";
            setTimeout(function(){
                key.style.display = "none";
                cg_1(1,ditu);
            },4000);
            ditu[x][y] = 0;
        }
//      打到大魔王
        function Damowang(x,y){
            duizhan.style.display = "block";
            xu = xu + gjl- 300;
            if (xu<=0){
                duizhan.style.display = "none";
                key.style.display = "block";
                key.innerHTML="<h1>胜败乃兵家常事，请大侠重新来过<h1> ";
                setTimeout(function(){
                    //战胜的情况
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                    if(duizhan.style.display = "none"){
                        box1.style.display = "block";
                        box2.style.display = "none";
                        shuxing.style.display = "none";
                    }
                },3000);

            }else{
                var shu1 = document.getElementById("shu1");
                    shu1.innerHTML="<h3>你当前的血量<h3>"+xu;
                sgs +=1;
                var shu4 = document.getElementById("shu4");
                    shu4.innerHTML="<h3>你当前的杀怪数<h3>"+sgs;
                setTimeout(function(){
                    duizhan.style.display = "none";
                    //战败的情况
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                },1000);
                ditu[x][y] = 0;
            }
        }
//救到公主
        function Gameover(){
            gameover.style.display ="block";
            setTimeout(function(){
                gameover.style.display = "none";
                //得到的情况
                    console.log(x)
                    console.log(y)
                    console.log(ditu[x][y])
                    cg_1(1,ditu);
                        if(gameover.style.display = "none"){
                            box1.style.display = "block";
                            box2.style.display = "none";
                            shuxing.style.display = "none";
                        }
            },4000);
        }


//地图函数
        function cg_1(nume){
            console.log("@@");
            var a = "";
            for(var i = 0; i < ditu.length; i++){
                for(var j = 0; j < ditu[i].length; j++){
                    if(ditu[i][j] == 1){// 墙
                        a += "<img class='tk'  src='imgs/wall.png'>";
                    }else if(ditu[i][j] == 0) {// 路
                        a += "<img class='tk'  src='imgs/lu.png'>";


                    }else if(ditu[i][j] == 2){
                        a += "<img class='tk'  src='imgs/boss.png'>";
                    }else if(ditu[i][j] == 4){
                        a += "<img class='tk'  src='imgs/key.png'>";
                    }else if(ditu[i][j] == 5){
                        a += "<img class='tk'  src='imgs/jian.png'>";
                    }else if(ditu[i][j] == 6){
                        a += "<img class='tk'  src='imgs/door.png'>";
                    }else if(ditu[i][j] == 7){
                        a += "<img class='tk'  src='imgs/huohai.png'>";
                    }else if(ditu[i][j] == 8){
                        a += "<img class='tk'  src='imgs/dajian.png'>";
                    }else if(ditu[i][j] == 9){
                        a += "<img class='tk'  src='imgs/xueping.png'>";
                    }else if(ditu[i][j] == 10){
                        a += "<img class='tk'  src='imgs/guai1.png'>";
                    }else if(ditu[i][j] == 11){
                        a += "<img class='tk'  src='imgs/s_lou.png'>";
                    }else if(ditu[i][j] == 12){
                        a += "<img class='tk'  src='imgs/x_lou.png'>";
                    }else if(ditu[i][j] == 13){
                        a += "<img class='tk'  src='imgs/s_lou2.png'>";
                    }else if(ditu[i][j] == 14){
                        a += "<img class='tk'  src='imgs/x_lou2.png'>";
                    }else if(ditu[i][j] == 15){
                        a += "<img class='tk'  src='imgs/gongzhu.jpg'>";
                    }else if(ditu[i][j] == 16){
                        a += "<img class='tk'  src='imgs/mowang.jpg'>";
                    }else if(ditu[i][j] == 17){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 18){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 19){
                        a += "<img class='tk'  src='imgs/angell.png'>";
                    }else if(ditu[i][j] == 20){
                        a += "<img class='tk'  src='imgs/angell.png'>";
                    }else if(ditu[i][j] == 21){
                        a += "<img class='tk'  src='imgs/wall.png'>";
                    }else if(ditu[i][j] == 22){
                        a += "<img class='tk'  src='imgs/wall.png'>";
                    }else if(ditu[i][j] == 23){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 24){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 25){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 26){
                        a += "<img class='tk'  src='imgs/lu.png'>";
                    }else if(ditu[i][j] == 3){
                        if(nume=="top"){
                            a = a +"<img id='Hero_t'  src='imgs/person_t.png'>";
                        }else if(nume=="bottom"){
                            a = a +"<img id='Hero_b'  src='imgs/person_b.png'>";
                        }else if(nume=="left"){
                            a = a +"<img id='Hero_l'  src='imgs/person_l.png'>";
                        }else if(nume=="right"){
                            a = a +"<img id='Hero_r'  src='imgs/person_r.png'>";
                        }
                        else{
                            a = a + "<img id='Hero'  src='imgs/person_b.png'>";
//                            x = i;
//                            y = j;
                        }
                    }
                }
//                a += "<br />";
            }
            box2.innerHTML = a;
        }
    }
    huantu(map);





</script>
</body>
</html>
